package cn.gson.crm.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the PAYMENTPLAN database table.
 * 
 */
@Entity
@NamedQuery(name="Paymentplan.findAll", query="SELECT p FROM Paymentplan p")
public class Paymentplan implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(initialValue=1,allocationSize=1,name="PAYMENTPLAN_PPID_GENERATOR", sequenceName="SEQ_33")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="PAYMENTPLAN_PPID_GENERATOR")
	@Column(name="PP_ID")
	private long ppId;

	@Column(name="PP_CAI_ID")
	private BigDecimal ppCaiId;

	@Column(name="PP_CAI_NAME")
	private String ppCaiName;

	@Column(name="PP_CUS_ID")
	private BigDecimal ppCusId;

	@Column(name="PP_CUS_NAME")
	private String ppCusName;

	@Column(name="PP_MAN")
	private String ppMan;

	@Column(name="PP_MONEY")
	private BigDecimal ppMoney;

	@Column(name="PP_PERIOD")
	private BigDecimal ppPeriod;

	@Column(name="PP_STATE")
	private String ppState;

	@Temporal(TemporalType.DATE)
	@Column(name="PP_TIME")
	private Date ppTime;

	//bi-directional many-to-one association to PurchaseTb
	@ManyToOne
	@JoinColumn(name="PURCHASE_ID")
	private PurchaseTb purchaseTb;

	//bi-directional many-to-one association to PurchaseTb
	@OneToMany(mappedBy="paymentplan")
	private List<PurchaseTb> purchaseTbs;

	public Paymentplan() {
	}

	public long getPpId() {
		return this.ppId;
	}

	public void setPpId(long ppId) {
		this.ppId = ppId;
	}

	public BigDecimal getPpCaiId() {
		return this.ppCaiId;
	}

	public void setPpCaiId(BigDecimal ppCaiId) {
		this.ppCaiId = ppCaiId;
	}

	public String getPpCaiName() {
		return this.ppCaiName;
	}

	public void setPpCaiName(String ppCaiName) {
		this.ppCaiName = ppCaiName;
	}

	public BigDecimal getPpCusId() {
		return this.ppCusId;
	}

	public void setPpCusId(BigDecimal ppCusId) {
		this.ppCusId = ppCusId;
	}

	public String getPpCusName() {
		return this.ppCusName;
	}

	public void setPpCusName(String ppCusName) {
		this.ppCusName = ppCusName;
	}

	public String getPpMan() {
		return this.ppMan;
	}

	public void setPpMan(String ppMan) {
		this.ppMan = ppMan;
	}

	public BigDecimal getPpMoney() {
		return this.ppMoney;
	}

	public void setPpMoney(BigDecimal ppMoney) {
		this.ppMoney = ppMoney;
	}

	public BigDecimal getPpPeriod() {
		return this.ppPeriod;
	}

	public void setPpPeriod(BigDecimal ppPeriod) {
		this.ppPeriod = ppPeriod;
	}

	public String getPpState() {
		return this.ppState;
	}

	public void setPpState(String ppState) {
		this.ppState = ppState;
	}

	public Date getPpTime() {
		return this.ppTime;
	}

	public void setPpTime(Date ppTime) {
		this.ppTime = ppTime;
	}

	public PurchaseTb getPurchaseTb() {
		return this.purchaseTb;
	}

	public void setPurchaseTb(PurchaseTb purchaseTb) {
		this.purchaseTb = purchaseTb;
	}

	public List<PurchaseTb> getPurchaseTbs() {
		return this.purchaseTbs;
	}

	public void setPurchaseTbs(List<PurchaseTb> purchaseTbs) {
		this.purchaseTbs = purchaseTbs;
	}

	public PurchaseTb addPurchaseTb(PurchaseTb purchaseTb) {
		getPurchaseTbs().add(purchaseTb);
		purchaseTb.setPaymentplan(this);

		return purchaseTb;
	}

	public PurchaseTb removePurchaseTb(PurchaseTb purchaseTb) {
		getPurchaseTbs().remove(purchaseTb);
		purchaseTb.setPaymentplan(null);

		return purchaseTb;
	}

}